﻿@using Classified.Service
@using Classified.Domain.Entities
@model IEnumerable<ClassifiedAd>
           
<ul class="thumbnails">
    @foreach (var item in Model)
    {
        var title = string.Empty;

        var discription = string.Empty;
        if (item.Title.Length > 30)
        {

            title = item.Title.Substring(0, 30) + "...";

        }
        else
        {
            title = item.Title;

        }
        if (item.Description.Length > 150)
        {

            discription = Convert.ToString(Html.Raw(item.Description.Substring(0, 150)) + "...");

        }
        else
        {

            discription = Convert.ToString(Html.Raw(item.Description));

        }
<li>
            <div class=" related-ads">
        @if (item.ClassifiedPicture.Count == 0)
        {
        
                <a class="thumbnail" href="@Url.Action("Details", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Title) })">
                    <img src="/Images/110/80/Images/no-image.jpg"  alt="no-image" /></a>
              
          
        }
        @foreach (var i in item.ClassifiedPicture)
        {
           
        
                <a class="thumbnail" href="@Url.Action("Details", "ClassifiedAds", new { id = i.ClassifiedId, seName = SeService.GetSeName(i.ClassifiedAds.Title) })">
                    <img src="/Images/110/80/classified/@i.ImageGuid"  alt="@item.Title" /></a>
               
           
            break;
        }
 </div>
        </li>
    }
</ul>

